package com.epcs.model.bo;

import java.util.ArrayList;
import java.util.List;

import com.epcs.model.dao.CommentDAO;
import com.epcs.model.dao.EventDAO;
import com.epcs.model.dto.Account;
import com.epcs.model.dto.Comment;
import com.epcs.model.dto.Event;
import com.epcs.util.EpcsDateTimeUtil;

public class CommentBO {

    // Tạo comment
    public boolean createComment(Comment comment) {
	CommentDAO dao = new CommentDAO();
	boolean result = dao.addComment(comment);

	return result;
    }

    // Lay tat ca Comment co cung 1 event id
    public List<Comment> getAllCommentByEventId(Event event) {

	List<Comment> allComment = new ArrayList<Comment>();
	CommentDAO dao = new CommentDAO();
	allComment = dao.getCommentListByEventId(event);

	return allComment;
    }
    //Lay 1 comment dua tren comment Id
    public Comment getCommentById(String commentId){
	
	Comment commentById = new Comment();
	CommentDAO dao = new CommentDAO();
	commentById = dao.getCommentById(commentId);
	
	return commentById;
    }

    // ---Deletecomment
    public boolean deleteComment(String commentId) {
	CommentDAO dao = new CommentDAO();
	Comment commentItem = dao.getCommentById(commentId);
	boolean result = dao.deleteComment(commentItem);

	return result;
    }

}
